package com.example.aircraft.panel;



import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;

import com.example.aircraft.MyApplication;
import com.example.aircraft.R;

public class MenuActivity extends Activity {

    private static final String TAG = "change";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
    }


    public void singleMode(View view) {
        Intent intent = new Intent(MyApplication.getContext(),ChoosePattern.class);
        startActivity(intent);
        MenuActivity.this.finish();
    }

//<<<<<<< HEAD
//=======
    public void doubleMode(View view) {
        //对战模式
//        Intent intent = new Intent(MyApplication.getContext(),ChoosePattern.class);
//        startActivity(intent);
//        MenuActivity.this.finish();
    }

//>>>>>>> d9ef400843bf41166ee8c442a18c92bdfca29fec
    public void storePanel(View view) {
        Intent intent = new Intent(MyApplication.getContext(),StorePanel.class);
        startActivity(intent);
    }

    public void exitGame(View view) {
        AlertDialog.Builder alertdialogbuilder = new AlertDialog.Builder(this);
        alertdialogbuilder.setMessage("确定要退出游戏吗");
        alertdialogbuilder.setPositiveButton("确定",click1);
        alertdialogbuilder.setNegativeButton("取消",click2);
        AlertDialog alertDialog = alertdialogbuilder.create();
        alertDialog.show();
    }

    private DialogInterface.OnClickListener click1 = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            android.os.Process.killProcess(android.os.Process.myPid());
        }
    };

    private DialogInterface.OnClickListener click2 = new DialogInterface.OnClickListener() {
        @Override
        public void onClick(DialogInterface dialog, int which) {
            dialog.cancel();
        }
    };


    public void showRank(View view) {
        Intent intent = new Intent(MyApplication.getContext(),RankPanel.class);
        startActivity(intent);
        MenuActivity.this.finish();
    }
}

